package home.fangyun.pagerank.domain;

import java.math.BigDecimal;
import java.math.MathContext;

public class Rank<V extends Vote> implements Comparable<Rank<V>> {
	private int rank;
	private BigDecimal weight;
	private V vote;

	public Rank(int rank, BigDecimal weight, V assess) {
		super();
		this.rank = rank;
		this.weight = weight;
		this.vote = assess;
	}

	public int getRank() {
		return rank;
	}

	public void setRank(int rank) {
		this.rank = rank;
	}

	public BigDecimal getWeight() {
		return weight;
	}

	public void setWeight(BigDecimal weight) {
		this.weight = weight;
	}

	public V getVote() {
		return vote;
	}

	public void setVote(V assess) {
		this.vote = assess;
	}

	@Override
	public int compareTo(Rank<V> o) {
		return this.weight.compareTo(o.weight);
	}

	@Override
	public String toString() {
		return "Rank [rank=" + rank + ", weight=" + weight.round(MathContext.DECIMAL128) + ", assess=" + vote + "]";
	}

}
